package com.atlzk.renting.user.MQ;

import com.atlzk.renting.user.service.impl.UserServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 * @author King
 * @date 2021/7/1 - 9:01
 */
@Service
@Slf4j
public class UserMQLister {

    @Autowired
    private UserServiceImpl userServiceImpl;



    @RabbitListener(queues = MQConfig.USER_QUEUE)
    public void seckillMQLister(HashMap<String, String> map) {
        String telephoneOrEmail = map.get("telephoneOrEmail");
        String code = map.get("code");
        System.out.println("手机号or邮箱："+telephoneOrEmail+",验证码："+code);
        String result = userServiceImpl.sendCodeForTelOrEmail(telephoneOrEmail, code);
        System.out.println(result);



    }
}
